package com.bhs.sansong.utils;

import android.content.Context;
import android.media.AudioAttributes;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.net.Uri;
import com.bhs.sansong.R;

import java.io.IOException;

public class VoiceUtils {
    private static MediaPlayer newOrder;
    private static final Uri newOrderUri=Uri.parse("android.resource://com.bhs.sansong/" + R.raw.received_order);

    //物流公司已结单
    public static void newOrder(Context context) {
        if (newOrder == null) {
            newOrder = new MediaPlayer();
            AudioAttributes attributes = new AudioAttributes.Builder()
                    .setLegacyStreamType(AudioManager.STREAM_MUSIC)
                    .build();
            newOrder.setAudioAttributes(attributes);
            try {
                newOrder.setDataSource(context, newOrderUri);
                newOrder.prepare();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        newOrder.start();
    }


}
